@extends('layouts.admin')
@section('title') @parent 文章添加 @stop
@section('page_title')@parent
添加文章
@show
@section('breadcrumb')@parent
{{ Breadcrumbs::render('article-create') }}
@show
@section('content')
<div class="row">
		@include('widgets.notification')
		<div class="col-md-12">
				<!-- general form elements -->
				<div class="box box-primary">
						<div class="box-header">
								<h3 class="box-title">添加律师</h3>
						</div>
						<form fole="form" method="post" action="{{ route('admin.users.addlawyer') }}" enctype="multipart/form-data">
						<input type="hidden" name="_token" value="{{ csrf_token() }}" />
						<div class="box-body">
								<div class="form-group">
										<label for="class">手机号</label>
										<input name="phone" id="phone" class="form-control" placeholder="手机号" value="{{ Input::old('phone') }}" required>
										{{ $errors->first('phone', '<strong class="error">:message</strong>') }}
								</div>
								<div class="form-group">
										<label class="control-label" for="password">密码</label>
										<input name="password" value="" class="form-control" type="password"  placeholder="密码" required>
									    {{ $errors->first('password', '<strong class="error">:message</strong>') }}
							</div>
								<div class="form-group">
										<label class="control-label" for="password_confirmation">确认密码</label>
										<input name="password_confirmation" value="" class="form-control" type="password"  placeholder="确认密码">
								</div>
								<div class="form-group">
										<label for="realname">真实姓名</label>
										<input name="realname" id="realname" class="form-control" placeholder="真实姓名" value="{{ Input::old('realname') }}" required>
										{{ $errors->first('realname', '<strong class="error">:message</strong>') }}
								</div>
								<div class="form-group">
										<label>律师头像</label>
										<div class="controls">
											<div class="input-group">
												 <input class="input-file" name="avatar" type="file">
											</div>
										</div>
								</div>
								<div class="form-group">
										<label for="title">邮箱</label>
										<input name="email" id="email" class="form-control" placeholder="邮箱" value="{{ Input::old('email') }}">
										{{ $errors->first('email', '<strong class="error">:message</strong>') }}
								</div>
								<!-- <div class="form-group">
										<label for="province">省</label>
										<select name="province" id="field_province" default="" required></select>
								</div>
								<div class="form-group">
										<label for="city">市</label>
										<select name="city" id="field_city" default="" required></select>
								</div>
								<div class="form-group">
										<label for="district">区</label>
										<select name="district" id="field_district" default="" ></select>
								</div>  -->
								<div class="form-group">
										<label>详细地址</label>
										<div class="controls">
											<div class="input-group">
												 <input class="form-control" name="address" placeholder="详细地址">
											</div>
										</div>
								</div>
								<div class="form-group">
										<label for="license">律师证</label>
										<input name="license" id="license" class="form-control" placeholder="执业执照" value="{{ Input::old('license') }}">
										{{ $errors->first('license', '<strong class="error">:message</strong>') }}
								</div>
								<div class="form-group">
										<label>执业执照</label>
										<div class="controls">
											<div class="input-group">
												 <input class="input-file" name="license_file" type="file">
											</div>
										</div>
								</div>
								<div class="form-group">
										<label for="company_name">所在律所</label>
										<input name="company_name" id="company_name" class="form-control" placeholder="所在律所" value="{{ Input::old('company_name') }}">
										{{ $errors->first('company_name', '<strong class="error">:message</strong>') }}
								</div>

								<div class="form-group">
										<label for="position">职位</label>
										<input name="position" id="position" class="form-control" placeholder="职位" value="{{ Input::old('position') }}">
										{{ $errors->first('position', '<strong class="error">:message</strong>') }}
								</div>
								<div class="form-group">
										<label for="practice_period">执业年限</label>
										<input name="practice_period" id="position" class="form-control" placeholder="如数字：10" value="{{ Input::old('practice_period') }}">
										{{ $errors->first('practice_period', '<strong class="error">:message</strong>') }}
								</div>
								<div class="form-group">
										<label for="introduce">律师简介</label>
										<textarea cols="80" rows="10" name="introduce" id="introduce" class="form-control">{{ Input::old('info') }}</textarea>
										{{ $errors->first('introduce', '<strong class="error">:message</strong>') }}
								</div>
						</div>
						<div class="box-footer">
								<a href="{{ route('admin.article.index') }}" class="btn btn-default btn-save">返 回</a>
								<button type="submit" class="btn btn-primary btn-save">保 存</button>
						</div>
						</form>
				</div>
		</div>
</div>
@stop
@section('end')
@parent
<script>
var area_data = {};
  $(document).on('change','#field_province', function(){
	var val = $(this).val();
	$(this).attr('default','');
	$('#field_city').html('');
	$('#field_district').html('');
	var city_ele = $('#field_city');
	var defval = '';
	if (val != '') {
	  defval = val.replace(/0000$/,'');
	}else{
	  return;
	}
	for (var key in area_data) {
	  var k = String(key);
	  if ( k.match(/^\d{4}00$/) && k.indexOf(defval)===0 ) {
		var op = document.createElement('option');
		op.value = k, op.innerHTML = area_data[k];
		if ( $('#field_city').attr('default') && $('#field_city').attr('default') == k  ) {
		  op.selected = true;
		}
		city_ele.append(op);
	  }
	}
	city_ele.attr('default','')
	city_ele.trigger('change');
  });
   $(document).on('change','#field_city', function(){
	var val = $(this).val();
	$(this).attr('default','');
	$('#field_district').html('');
	if (val != '') {
	  defval = val.replace(/00$/,'');
	}else{
	  return;
	}
	var district_ele = $('#field_district');
	for (var key in area_data) {
	  var k = String(key);
	  if ( k.indexOf(defval) === 0 && k.substr(-2)!='00' ) {
		var op = document.createElement('option');
		op.value = k, op.innerHTML = area_data[k];
		if ( $('#field_district').attr('default') && $('#field_district').attr('default') == k  ) {
		  op.selected = true;
		}
		district_ele.append(op);		
	  }
	}
	district_ele.attr('default','');
  });
</script>
@stop